File file = new File(this.args[0])
String SUFFIX = "patch"

file.eachFile {
	if(it.absolutePath.endsWith("$SUFFIX")){

		String cpname = it.absolutePath + "." + "cp"
		println "generate " + it.name + ".cp ..."
		
		File f = new File(cpname)
		def writer = f.newPrintWriter()
		
		it.readLines("UTF-8").each{
			writer.println(it.getBytes("UTF-8").encodeBase64().toString())
		}
		
		writer.flush()
		writer.close()

		println "open $cpname"
		
		"notepad $cpname".execute()
		
		print "press enter key to continue ..."
		System.in.read()
	}
}

